<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./lib/vue.js"></script>
    <style>
        html, body {
            margin: 0px;
            padding: 0px;
        }
        .container {
            height: 100vh;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .stage {
            position: relative;
            border: 1px solid gray;
        }
        .stage .tip {
            position: absolute;
            top: -25px;
            border-radius: 7px;
            width: 160px;
            padding: 3px;
            font-size: 12px;
            background-color: rgba(0, 0, 0, 0.5);
        }
        .stage .row {
            width: 100%;
        }
        .stage .row:after {
            clear: both;
            content: "";
            visibility: hidden;
            height: 0px;
            display: block;
        }
        .stage .block {
            text-align: center;
            font-size: 12px;
            position: relative;
            float: left;
            height: 40px;
            width: 40px;
            background-size: 100%;
            background-image: url(./res/block.gif);
        }
        .stage .block .treasure{
            height: 35px;
            width: 35px;
            background-size: 100%;
            background-image: url(./res/ball.png);
            position: absolute;
            top: 2px;
            left: 3px;
            z-index: 11;
        }
        .stage .block .obstacle{
            height: 52px;
            width: 40px;
            background-size: 100%;
            background-image: url(./res/wall.png);
            position: absolute;
            top: -12px;
            left: 0px;
            z-index: 11;
        }
        .stage .block .index {
            color: gray;
            position: absolute;
            top: 0px;
            width: 100%;
            text-align: center;
            font-size: 12px;
            z-index: 10;
        }
        .stage .block .agent {
            height: 48px;
            width: 40px;
            background-size: 100%;
            position: absolute;
            top: -20px;
            z-index: 11;
        }
        .stage .block .agent.left {
            background-image: url(./res/left.png);
        }
        .stage .block .agent.right {
            background-image: url(./res/right.png);
        }
        .stage .block .agent.up {
            background-image: url(./res/up.png);
        }
        .stage .block .agent.down {
            background-image: url(./res/down.png);
        }

    </style>
</head>
<body>
    <div class="container">
        <div class="stage">
            <div class="tip" v-if="showTip_">{{tipText_}}</div>
            <div class="row" v-for="y in size.width">
                <div class="block" v-for = "x in size.height">
                    <div class="index">{{x-1}}, {{y-1}}</div>
                    <div
                        class="agent"
                        :class="direction"
                        v-if="(x-1) === coords.x && (y-1) === coords.y">
                    </div>
                    <!-- treasure -->
                    <div class="treasure" v-for="target in targets" v-if="(x-1) === target.x && (y-1) === target.y"></div>
                    <!-- obstacles -->
                    <div class="obstacle" v-for="obstacle in obstacles" v-if="(x-1) === obstacle.x && (y-1) === obstacle.y"></div>
                </div>
            </div>
        </div>
    </div>
    <script src="./js/env.js"></script>
    <script src="./js/qtable.js"></script>
    <script src="./js/rl.js"></script>
    <script src="./js/main.js"></script>
</body>
</html>